import MasterModal from "./MasterModal.vue";
import PageTurn from "./plugins/PageTurn.vue";
import ToolBar from "./plugins/ToolBar.vue";
import DiffContent from "./plugins/DiffContent.vue";
import {MasterModalProps} from "./type";
import Vue, {VueConstructor} from "vue";
window.MasterModalInstance = [];
(MasterModal as any).install = function (Vue: any) {
    Vue.component("MasterModal", MasterModal);
    Vue.component("PageTurn", PageTurn);
    Vue.component("ToolBar", ToolBar);
    Vue.component("DiffContent", DiffContent);
};



(MasterModal as any).show = function (params: Partial<MasterModalProps>) {
    const ModalInstance: VueConstructor = Vue.extend(MasterModal)
    const instance = new ModalInstance({propsData:params})
    // 手动挂载组件实例到一个新的div元素
    const container = document.createElement('div');
    document.getElementById('app')?.appendChild(container);
    instance.$mount(container);
    window.MasterModalInstance.push(instance)
}





export default MasterModal;
